home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / netmail / rnr214.zip / RNRMOUS.PAS < prev    next >
Pascal/Delphi Source File  |  1996-02-01  |  3KB  |  149 lines

  1. unit rnrmous;
  2.  
  3. {
  4.  
  5. rnrmous.pas - rnr mouse handling things
  6.  
  7. with any screen output call mousehide() before and
  8. mouseshow() after
  9.  
  10. with any exec...() call mouseshutdown() before and mouseinit() after
  11.   (use execresult, which won't get globbered by mouseinit)
  12.  
  13. if there is no mouse driver loaded, or it was compiled
  14. without $define mouse these will have no effect, but will
  15. make the same code work with and without a mouse.
  16.  
  17. }
  18.  
  19. {
  20. the mouse unit I have is from Turbo Technix v1n4, p52
  21.  
  22. see the file `technixm.zip' in ths source distribution.  note that
  23. various fixes have been applied, especially in the light-pen and
  24. ratio functions (in mouse.pas).
  25. }
  26.  
  27. {$I rnr-def.pas}
  28.  
  29. interface
  30.  
  31. {$ifdef mouse}
  32.  
  33. uses mouse,rnrglob,rnrconf;
  34.  
  35. {$endif}
  36.  
  37. procedure mouseinit;
  38. procedure mouseshutdown;
  39.  
  40. procedure mousehide;
  41. procedure mouseshow;
  42.  
  43. implementation
  44.  
  45. {$ifdef mouse}
  46.  
  47. procedure mousehandler     { Mouse event handler called by device driver }
  48.    (flags, cs, ip, ax, bx, cx, dx, si, di, ds, es, bp: word);
  49. interrupt;
  50.  
  51. begin
  52.   mousevent.event     := ax;
  53.   mousevent.btnstatus := bx;
  54.   mousevent.horiz     := cx;
  55.   mousevent.vert      := dx;
  56.   inline (        { Exit processing for far return to device driver }
  57.        $8B/$E5/            { MOV  SP, BP }
  58.        $5D/                { POP  BP }
  59.        $07/                { POP  ES }
  60.        $1F/                { POP  DS }
  61.        $5F/                { POP  DI }
  62.        $5E/                { POP  SI }
  63.        $5A/                { POP  DX }
  64.        $59/                { POP  CX }
  65.        $5B/                { POP  BX }
  66.        $58/                { POP  AX }
  67.        $CB );              { RETF    }
  68. end;
  69.  
  70. {$endif}
  71.  
  72. procedure mouseinit;
  73.  
  74. begin
  75.  
  76. {$ifdef mouse}
  77.  
  78.   if not ignoremouse then
  79.     begin
  80.       mreset(themouse);
  81.       hasmouse := themouse.exists;
  82.     end;
  83.  
  84.   if hasmouse then
  85.     begin
  86.       minsttask($14,seg(mousehandler),ofs(mousehandler));
  87.       mousevent.event := 0;
  88.       mouseshow;
  89.     end;
  90.  
  91. {$endif}
  92.  
  93. end;
  94.  
  95. procedure mouseshutdown;
  96.  
  97. begin
  98.  
  99. {$ifdef mouse}
  100.  
  101.   if hasmouse then
  102.     begin
  103.       mouseshow;
  104.       mreset(themouse);
  105.     end;
  106.  
  107. {$endif}
  108.  
  109. end;
  110.  
  111.  
  112.  
  113.  
  114.  
  115. procedure mousehide;
  116.  
  117. begin
  118.  
  119. {$ifdef mouse}
  120.   if hasmouse then
  121.     mhide;
  122. {$endif}
  123.  
  124. end;
  125.  
  126. procedure mouseshow;
  127.  
  128. begin
  129.  
  130. {$ifdef mouse}
  131.   if hasmouse then
  132.     mshow;
  133. {$endif}
  134.  
  135. end;
  136.  
  137. procedure mousereset;
  138.  
  139. begin
  140.  
  141. {$ifdef mouse}
  142.   if hasmouse then
  143.     mreset(themouse);
  144. {$endif}
  145.  
  146. end;
  147.  
  148. end.
  149.